package cn.ges.movie.vo.mv

import cn.ges.base.sta.entity.user.BgUser
import cn.ges.base.sta.vo.base.BgSimpleModifyVO
import java.math.BigDecimal
import java.time.LocalDate
import java.time.LocalDateTime

/**
 *
 * @author gespent@163.com
 * @date 2021/4/16 10:31
 */
open class MovieQueryVO : BgSimpleModifyVO<BgUser>() {

    var longitude: BigDecimal? = null
    var latitude: BigDecimal? = null

    var size: Long? = null
    var current: Long? = null

    /**
     * 电影ID
     */
    var mvId: Long? = null

    /**
     * 查询时间要求 1代表当天 2=近三天 3=近五天
     */
    var timeLimit: Int = 1

    var startTme: LocalDateTime? = null

    var endTme: LocalDate? = null



    override fun check(): Boolean {
        if (size == null || current == null || longitude == null || latitude == null || mvId == null) {
            errorMsg = "有必填参数为空"
            return false
        }
        val now = LocalDate.now()
        startTme= LocalDateTime.now()

        endTme = when (timeLimit) {
            1 -> {
                now.plusDays(1)
            }
            2 -> {
                now.plusDays(4)
            }
            else -> {
                now.plusDays(6)
            }
        }
        return true
    }
}